<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path;
%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
<title>相册编辑-教师-云校通</title>
<jsp:include page="/WEB-INF/page/common/_header.jsp"></jsp:include>
<body ontouchstart>
	<div class="weui_tab tab-bottom">
		<div class="weui-header bg-blue"> 
	  		<div class="weui-header-left"><a onclick="back()" href="javascript:;" class="icon icon-109 f-white">返回</a></div>
	    	<h1 class="weui-header-title">班级相册编辑</h1>
	    </div>
		<div class="weui_tab_bd pb40">
			<div class="weui_cells weui_cells_form mt0">
	            <div class="weui_cell">
	                <div class="weui_cell_bd weui_cell_primary">
	                    <textarea id="content" class="weui_textarea" placeholder="此时此刻说点什么呗……" rows="5">${detail.content }</textarea>
	                </div>
	            </div>
	        </div>
	        <div class="weui_btn_area">
		        <a href="javascript:" class="weui_btn bg-blue" id="album-submit">修改说说</a>
		    </div>
	        
	        <div class="weui_cells">
	        	<div class="weui_cell">
		        	<ul class="weui_uploader_files img-click">
		        		<c:forEach var="itm" items="${detail.attachList }">
		        			<li data-id="${itm.id }" class="pr mb5">
		        				<div class="img-del" onclick="imgDel(this)">
		        					<span class="icon icon-26 f25"></span>
		        				</div>
		        				<img onclick="imgClick(this)" class="img-max" src="${config.imgUrl}${itm.attachmentUrl}"/>
		        			</li>
			        	</c:forEach>
	                </ul>
	            </div>
	        </div>
		</div>
  </div>
	
<script type="text/javascript">
	$(function() {
		$("#album-submit").click(function() {
			albumUpdate();
		})
	})
	function albumUpdate() {
		var content = $("#content").val().trim();
		if(content.length == 0) {
			$.toast("内容不能为空", "cancel");
			return;
		}
		$.ajax({
         	url : basePath + "/ls/album/class/update",
 	 		type : "post",
 	 		dataType : "json",
 	 		data : {
 	 			id: "${detail.id}",
 	 			content: content
 	 		},
            success: function(data){
            	if(data.code == '000') {
            		$.toast("修改成功");
            		return;
            	}
            	$.toast(data.msg, "cancel");
            },
            error: function(xhr, type){
            }
         });
	}
</script>
</body>
</html>